//
//  YCOrderSearchTableViewCell.m
//  lianganyuchu
//
//  Created by iMac on 17/2/28.
//  Copyright © 2017年 杭州桑缇电子商务有限公司. All rights reserved.
//

#import "YCOrderSearchTableViewCell.h"

@implementation YCOrderSearchTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    CGFloat width=kMainScreen_Width-2*kDistance;
    [self.backView addShadowWith:CGSizeMake(width, 195)];
    
    self.viewTop.layer.cornerRadius=2.0f;
    self.viewBottom.layer.cornerRadius=2.0f;
    
    [self.labOrderStatus setFont:[UIFont LightFontOfSize:16]];
    [self.labPhone setFont:[UIFont LightFontOfSize:18]];
    [self.labName setFont:[UIFont LightFontOfSize:14]];
    [self.labMeals setFont:[UIFont LightFontOfSize:17]];
    [self.labAddress setFont:[UIFont LightFontOfSize:14]];
    [self.labelTime setFont:[UIFont LightFontOfSize:14]];
    [self.label1 setFont:[UIFont LightFontOfSize:15]];
    [self.label2 setFont:[UIFont LightFontOfSize:15]];
    
    [self.label1 setTextColor:TEXT_DEEP];
    [self.label2 setTextColor:TEXT_DEEP];
    [self.labAddress setTextColor:TEXT_LIGHT];
    [self.labelTime setTextColor:TEXT_LIGHT];
    [self.labMeals setTextColor:TEXT_DEEP];
    [self.labPhone setTextColor:BLUE_COLOR];
    [self.labName setTextColor:TEXT_MIDDLE];
    [self.labOrderStatus setTextColor:MAIN_COLOR];
    [self.labPhone click:self action:@selector(phoneClicked:)];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)bindWith:(OrderTable *)order
{
    _order=order;
    
    CGFloat width=kMainScreen_Width-2*kDistance;
    CGFloat height=getTextSize(order.item_name, kMainScreen_Width-80, [UIFont LightFontOfSize:17]).height+getTextSize(order.addr_address, kMainScreen_Width-184, [UIFont LightFontOfSize:14]).height-39;
    [self.backView addShadowWith:CGSizeMake(width, height+195)];
    
    [self.labName setText:order.addr_name];
    [self.labPhone setText:order.addr_tele];
    [self.labOrderStatus setText:order.status_name];
    [self.labMeals setText:order.item_name];
    
    [self.labelTime setText:order.meal_time];
    [self.labAddress setText:order.addr_address];
}
-(void)phoneClicked:(id)sender
{
    [self.labPhone callPhoneWith:_order.addr_tele];
}

@end
